package com.longcai.service.fuyoupay.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.longcai.bean.PageHelper;
import com.longcai.entity.payment.fuyou.request.ClyjFuyouSubamountProportion;
import com.longcai.mapper.fuyoupay.ClyjFuyouSubamountProportionMapper;
import com.longcai.page.table.PageTableResponse;
import com.longcai.service.fuyoupay.ClyjFuyouSubamountProportionService;

/**
 * <p>
 * 富友支付分账规则中--分账比例的设定 服务实现类
 * </p>
 *
 * @author ZJ
 * @since 2019-03-31
 */
@Service
public class ClyjFuyouSubamountProportionServiceImpl extends ServiceImpl<ClyjFuyouSubamountProportionMapper, ClyjFuyouSubamountProportion> implements ClyjFuyouSubamountProportionService {
	@Autowired
	private ClyjFuyouSubamountProportionMapper ClyjFuyouSubamountProportionMapper;
	@Override
	public PageTableResponse subamountProportionListPage(ClyjFuyouSubamountProportion clyjFuyouSubamountProportion,
			PageHelper pageHelper) {

        Page<ClyjFuyouSubamountProportion> page = new Page<>(pageHelper.getStart(), pageHelper.getLength());
        QueryWrapper<ClyjFuyouSubamountProportion> queryWrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(clyjFuyouSubamountProportion.getLoginId()) ){
            queryWrapper.eq("login_id", clyjFuyouSubamountProportion.getLoginId());
        }
        IPage<ClyjFuyouSubamountProportion> clyjFuyouSubamountProportionIPage = this.ClyjFuyouSubamountProportionMapper.selectPage(page, queryWrapper);
        PageTableResponse pageTableResponse = new PageTableResponse(clyjFuyouSubamountProportionIPage.getTotal(), clyjFuyouSubamountProportionIPage.getTotal(), clyjFuyouSubamountProportionIPage.getRecords());

        return pageTableResponse;
	}

}
